package jt.android.platformania.world;

import android.graphics.Point;

import java.io.Serializable;
import java.lang.Math;

public abstract class Object implements Serializable {
	
	//private variables
	private Point 	loc;
	private int 	width, 
					height, 
					imageid;
	private boolean phased;
	
	//setters
	public void 	setLocation(Point p) 						{ loc = p; }
	public void 	setLocation(int x, int y) 					{ loc.set(x, y); }
	
	public void 	offsetLocation(double rad, int distance) 	{ loc.offset((int)(distance*Math.cos(rad)), (int)(distance*Math.sin(rad))); }
	public void 	offsetLocation(int dx, int dy) 				{ loc.offset(dx, dy); }
	
	public void 	setSize(int w, int h) 						{ width = w; height = h; }
	public void 	scale(double s)								{ width *= s; height *= s; }

	public void 	setImageID(int i)							{ imageid = i; }
	
	//phased objects cannot interact with other objects
	public void 	setPhased(boolean b)						{ phased = b; }
	
	//getters
	public Point 	getLocation()								{ return loc; }
	public int		getWidth()									{ return width; }
	public int		getHeight()									{ return height; }
	public int 		getImageID()								{ return imageid; }
	public boolean 	getPhased()									{ return phased; }
	//update method
	public abstract void update();
	
}
